package com.qf.utils;

import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Utils {
    public static String md5(String str){
        try {
            MessageDigest md5=MessageDigest.getInstance("MD5");
            byte [] bytes=str.getBytes("UTF-8");

            for (int i = 0; i <bytes.length ; i++) {
                bytes[i]-=5;
            }
            md5.update(bytes);

            byte [] digest=md5.digest();

            return new BigInteger(1,digest).toString(16);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
